window.onload = function () {
    var cha = document.getElementById("sss");
    var myTestRegex = document.getElementsByClassName("regex");
    var myError = document.getElementsByClassName("error");
    var table = document.getElementById("Table");
    var chongzhi = document.getElementById("ccc");
    var tr = table.getElementsByTagName("tr");
    chongzhi.onclick = function () {
        myError[0].style.display = "none";
        for (i = 0; i < myTestRegex.length; i++) {
            myTestRegex[i].value = "";
        }
    }
    cha.onclick = function () {
        if (myTestRegex[0].value === "" && myTestRegex[1].value === "" && myTestRegex[2].value === "") {
            myError[0].style.display = "inline";
            myError[0].innerHTML = "请输入查询条件!";
        } else {
            if (tr[1].style.display === "none") {
                alert("根据您的输入，未查询到相关用户！");
            } else {
                alert("根据您的输入,匹配结果如下");
            }
        }
    }
}

function myFunction1() {
    // 声明变量
    var myTestRegex = document.getElementsByClassName("regex");
    var filter = myTestRegex[0].value.toUpperCase();
    var table = document.getElementById("Table");
    var tr = table.getElementsByTagName("tr");

    // 循环表格每一行，查找匹配项
    for (i = 0; i < tr.length; i++) {
        var td = tr[i].getElementsByTagName("td")[1];
        if (td) {
            if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
            } else {
                tr[i].style.display = "none";
            }
        }
    }
}

function myFunction2() {
    // 声明变量
    var myTestRegex = document.getElementsByClassName("regex");
    var filter = myTestRegex[1].value.toUpperCase();
    var table = document.getElementById("Table");
    var tr = table.getElementsByTagName("tr");

    // 循环表格每一行，查找匹配项
    for (i = 0; i < tr.length; i++) {
        var td = tr[i].getElementsByTagName("td")[3];
        if (td) {
            if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
            } else {
                tr[i].style.display = "none";
            }
        }
    }
}

function myFunction3() {
    // 声明变量
    var myTestRegex = document.getElementsByClassName("regex");
    var filter = myTestRegex[2].value.toUpperCase();
    var table = document.getElementById("Table");
    var tr = table.getElementsByTagName("tr");

    // 循环表格每一行，查找匹配项
    for (i = 0; i < tr.length; i++) {
        var td4 = tr[i].getElementsByTagName("td")[4];
        var td5 = tr[i].getElementsByTagName("td")[5];
        var td6 = tr[i].getElementsByTagName("td")[6];
        if (td4 || td5 || td6) {
            if (td4.innerHTML.toUpperCase().indexOf(filter) > -1 || td5.innerHTML.toUpperCase().indexOf(filter) > -1 || td6.innerHTML.toUpperCase().indexOf(filter) > -1) {
                tr[i].style.display = "";
            } else {
                tr[i].style.display = "none";
            }
        }
    }
}